package com.smartthinking.dive;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.widget.Button;

import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;

public class MapaEventos extends android.support.v4.app.FragmentActivity{
	
	private GoogleMap mapa = null;
	String eve_lat, eve_lng;
	Button home;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.mmapaeventos);
		home = (Button) findViewById(R.id.btnHOME);
		home.setOnClickListener(new View.OnClickListener() {
			public void onClick(View arg0)
			{
				finish();
				Intent intent1 = new Intent(MapaEventos.this,Principal.class);
				intent1.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
				startActivity(intent1);
			}
		});
		
		Log.i("latitud1",""+eve_lat);
		Bundle extras1 = getIntent().getExtras();
		eve_lat = extras1.getString("query29");
		Log.i("latitud2",""+eve_lat);
		eve_lng = extras1.getString("query30");
		
		mapa = ((SupportMapFragment) getSupportFragmentManager()
				   .findFragmentById(R.id.map)).getMap();
		
		if (mapa != null) 
		{
	  mapa.addMarker(new MarkerOptions().position(new LatLng(Double.parseDouble(eve_lat),Double.parseDouble(eve_lng))));
	  
	  mapa.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(Double.parseDouble(eve_lat),Double.parseDouble(eve_lng)), 15));
	  
		}
		
	}
	
}